#include "Thread.hpp"
#include "Mutex.hpp"
#include <iostream>
#include <unistd.h>
#include "ThreadPool.hpp"
#include "Task.hpp"
#include <memory>

// void* run(void* args){
//     string name = static_cast<const char*>(args);
//     while(true){

//         cout<<name<<endl;
//         sleep(1);

//     }
//     return nullptr;

// }

int main()
{
    //unique_ptr<ThreadPool<Task>> tp(new ThreadPool<Task>);
    ThreadPool<Task>::getInstance()->run();
    //tp->run();

    int x, y;
    char op;

    while (true)
    {
        cout << "请输入数据1#";
        cin >> x;
        cout << "请输入数据2#";
        cin >> y;
        cout << "请输入运算符#";
        cin >> op;
        Task t(x, y, op, mymath);
        cout << "你刚刚录入了一个任务：" << t.toTaskString() << ",确认提交吗？【Y/N】" << endl;
        char confirm;
        cin >> confirm;
        if (confirm == 'y')
        {
            ThreadPool<Task>::getInstance()->push(t);
            cout<<endl;
        }
        

    }

    return 0;
}